<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>ms-repeat</title>
        <script src="../avalon.js"></script>
        <script>
            var model = avalon.define("test", function(vm) {
                vm.array = [1, 2, 3, 4]
                vm.a = {
                    b: 1,
                    c: 2
                }
            })
            setTimeout(function() {
                //alert(JSON.stringify(model.$model))
                model.array = []
            }, 3000)
        </script>
    </head>
    <body ms-controller="test">
        <p>注意在同一元素里 ms-if的优先级高于ms-repeat，如果ms-if里用于监控数组里面的一些变量（如$first, $last, el）会报错，这时应改用ms-if-loop</p>
        <p>忽略掉最后一个元素</p>
        <ul>
            <li ms-repeat="array" ms-if-loop="!$last">{{el}}</li>
            <li ms-if="array.size() == 0">当前数组为空</li>
        </ul>
        <p>下面是ms-each与ms-if的示例</p>
        <ul ms-each="array">
            <li ms-if="$last">{{el}}</li>
        </ul>

    </body>
</html>
